home *** CD-ROM | disk | FTP | other *** search
AMOS Source Code | 1991-12-03 | 3.0 KB | 127 lines |
- ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ' Dynamic Bob Squisher
- ' (packs and then squashes for compression of up to 90%)
- '
- ' By P.J.Hickman
- ' (using routines from Francois Lionet & Gary Symons)
- '
- ' This code is (c) Copyright 1991 Europress Software
- '
- ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Screen Open 0,640,200,2,Hires
- Flash Off
- Curs Off
- Palette $0,$FFF
- '
- For LOP=1 To 16
- Erase LOP
- Next LOP
- '
- F$=Fsel$("*.Abk","","Enter sprite bank to load")
- If F$=""
- End
- End If
- Load F$
- If Length(1)=0
- Edit
- End If
- '
- MXSPR=Length(1)
- Print "Number of bobs: ";MXSPR
- STSPR=1
- ENSPR=MXSPR
- Repeat
- Input "Number of colours? ";NCOL
- NPLANE=1 : C=2
- While C<>NCOL and NPLANE<7
- Inc NPLANE : C=C*2
- Wend
- Until NPLANE<7
- '
- BNUMB=15
- Repeat
- BWORK=Rnd(8)+6
- Until BWORK<>BNUMB
- '
- Screen Open 0,320,200,NCOL,0
- Flash Off : Get Sprite Palette
- Paper 0 : Pen 1 : Clw : BIGX=0 : BIGY=0
- '
- For N=1 To MXSPR
- If N>=STSPR and N<=ENSPR
- Cls 0,0,0 To 320,100
- A=Sprite Base(N)
- SX=Deek(A)*16 : SY=Deek(A+2)
- ICOL=Deek(A+4)
- If ICOL<>0
- Paste Bob 0,0,N
- Erase BWORK : Pack 0 To BWORK,0,0,SX,SY
- Add PSIZE,Length(BWORK)
- Add NSIZE,((SX*SY)/8)*NPLANE
- Print At(0,24);"Normal size";NSIZE;" / Packed size";PSIZE;
- If SX>BIGX
- BIGX=SX
- End If
- If SY>BIGY
- BIGY=SY
- End If
- End If
- End If
- Next
- '
- Reserve As Data BNUMB,PSIZE+MXSPR*10+4
- APACK=Start(BNUMB)+MXSPR*10
- Clw : Centre At(,24)+"...Final size:"+Str$(PSIZE+MXSPR*10+4)+" ("+Str$(NSIZE)+" )..."
- OLDSIZE=PSIZE+MXSPR*10+4
- '
- For N=1 To MXSPR
- If N>=STSPR and N<=ENSPR
- Cls 0,0,0 To 320,100
- A=Sprite Base(N)
- SX=Deek(A)*16 : SY=Deek(A+2)
- ICOL=Deek(A+4)
- If ICOL<>0
- Paste Bob 0,0,N
- Erase BWORK : Pack 0 To BWORK,0,0,SX,SY
- AOFF=Start(BNUMB)+(N-1)*10
- Doke AOFF,(APACK-Start(BNUMB))/2
- Loke AOFF+2,Leek(A) : Loke AOFF+6,Leek(A+6)
- Copy Start(BWORK),Start(BWORK)+Length(BWORK) To APACK
- Add APACK,Length(BWORK)
- End If
- End If
- Next
- '
- '
- Screen Open 0,640,200,2,Hires
- Flash Off
- Curs Off
- Palette $0,$FFF
- Print "Please wait, I am now squashing bank....."
- View
- L= Extension_5_00CE(Start(BNUMB),Length(BNUMB),-1,512,17)
- Print "The bank is now fully squished!!!"
- Print "It is actually now only";L;" bytes long!!"
- Print "(The original was";NSIZE;" bytes)"
- Print
- Print "Please remember these numbers:-"
- Print "1]";OLDSIZE
- Print "2]";L
- Print "3]";NCOL
- Print
- Print "Both of these numbers are needed when you unsquish your sprites!!"
- Print "Please write them down!!!!!!"
- Print
- Print "PRESS A KEY TO SAVE THE SQUASHED SPRITES"
- Wait Key
- F$=Fsel$("*.Squished","","Please enter saved bank name...")
- If F$<>""
- If Upper$(Right$(F$,9))<>".SQUISHED"
- F$=F$+".Squished"
- End If
- Bsave F$,Start(BNUMB) To Start(BNUMB)+L
- End If
- '
- For LOP=1 To 16
- Erase LOP
- Next LOP